package com.hyc.service;


import com.hyc.annotation.FinishService;
import com.hyc.pojo.Task;

import java.util.Random;
import java.util.UUID;

@FinishService(canRetry = true)
public class TaskServiceImpl implements TaskService {
    @Override
    public Task getTaskById(Integer id) {
        System.out.println("客户端查询了" + id + "的用户");
        // 模拟从数据库中取用户的行为
        Random random = new Random();
        Task task = Task.builder().TaskName(UUID.randomUUID().toString())
                .id(id)
                .complete(random.nextBoolean()).build();
        return task;
    }

    @Override
    public Integer insertTaskId(Task task) {
        System.out.println("插入数据成功" + task.getTaskName());
        return task.getId();
    }
}